package com.inossem.warehousestorage_inossem.request.inStorage.chuangyou;

import android.content.Context;

import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.inossem.warehousestorage_inossem.bean.inStorage.InStorageFreeListBean;
import com.inossem.warehousestorage_inossem.bean.inStorage.chuangyou.CYInStorageCheckSNCodeRequestBean;
import com.inossem.warehousestorage_inossem.bean.inStorage.chuangyou.CYInStorageProductionCheckSearchBean;
import com.inossem.warehousestorage_inossem.constant.RequestConstant;
import com.inossem.warehousestorage_inossem.listener.GsonBeanListener;
import com.inossem.warehousestorage_inossem.listener.StringRequestListener;
import com.inossem.warehousestorage_inossem.manage.RequestManage;
import com.inossem.warehousestorage_inossem.model.StringResponse;
import com.inossem.warehousestorage_inossem.request.Request;

import java.util.HashMap;
import java.util.Map;

/**
 * TODO
 *
 * @author 王斯宇
 * @time on 2018/4/4 12:03
 * @email siyu.wang@inossem.com
 */
public class CYInStorageProductionCheckSearchRequest extends Request {
    private static final String CONDITION = "condition";

    public static String request(Context context, CYInStorageCheckSNCodeRequestBean bean, GsonBeanListener gsonBeanListener) {
        String tag;
        Gson gson = new Gson();
        String params = gson.toJson(bean, bean.getClass());
        String url = RequestManage.getUrl(context, RequestConstant.CY_URL_IN_STORAGE_PRODUCTION_CHECK_SEARCH);
        tag = RequestManage.getHttpsPostWithLoading(context, url,params , new StringRequestListener() {
            @Override
            public void onSuccess(StringResponse stringRequestResponse) {
                Gson gson = new Gson();
                CYInStorageProductionCheckSearchBean bean = gson.fromJson(stringRequestResponse.getResponseInfo(), CYInStorageProductionCheckSearchBean.class);
                excuteJsonBeanNew(context, bean, gsonBeanListener);
            }
        });
        return tag;
    }
}
